 /* *********
  *    Author: chenjianbin;
  *    Copyright: ArrayUtils;
  *    Date: 2016-09-7;
  ********* */
const ArrayTool = {};

ArrayTool.oneToTwo = function (arrayData) {
  const b = [];
  const totalPageNumber = Math.ceil(arrayData.length / 30);
  for (let i = 0; i < totalPageNumber; i++) {
    b[i] = [];
    for (let k = 0; k < 30; k++) {
      const flog = (i * 30) + k;
      if (arrayData[flog]) {
        b[i][k] = arrayData[flog];
      }
    }
  }
  return { data:b, totalPageNo:totalPageNumber };
};

ArrayTool.twoToOne = function (arrayData) {
  const formData = [];
  for (let i = 0; i < arrayData.length; i++) {
    for (let k = 0; k < arrayData[i].length; k++) {
      formData.push(arrayData[i][k]);
    }
  }
  return formData;
};

export default ArrayTool;
